package com.xiaodai.miaosha.controller;

import com.xiaodai.miaosha.service.IMsuserService;
import com.xiaodai.miaosha.vo.LoginVo;
import com.xiaodai.miaosha.vo.RespBean;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * *auther:xiaodai
 * *date:2022/3/151:21 PM
 * *describe:
 */
@Controller
@Slf4j
public class LoginController {

    @Autowired
    private IMsuserService iMsuserService;

    @RequestMapping("/")
    public static String toLogin(){
        return "login2";
    }
    @PostMapping("/login/doLogin")
    @ResponseBody
    public RespBean doLogin(LoginVo loginVo, HttpServletRequest request, HttpServletResponse response){
        return iMsuserService.doLogin(loginVo,request,response);
    }
}
